date_sunset
Returns the sunset time for a given date and location
date_sunset()
function returns the sunset time of the specified date and place.
Tip: See the date_sunrise()
function to return the sunrise time of the specified date and place.
Return to the sunset time in Lisbon, Portugal today:
<?php // Shanghai, China: // Dimension: North latitude 31.22, longitude: West latitude 121.47 // Zen ~= 90, offset: +8 GMT echo ( "Shanghai, China: Date: " . date ( "DM d Y" ) ) ; echo ( "<br>Sunrise time:" ) ; echo ( date_sunrise ( time ( ) , SUNFUNCS_RET_STRING , 31.22 , 121.47 , 90 , 8 ) ) ; ?>
Try it yourself
date_sunset ( timestamp , format , latitude , longitude , zenith , gmtoffset ) ;
parameter | describe |
---|---|
timestamp | Required. Specifies the date and time stamp to calculate the sunset time. |
format |
Optional. Specifies how to return the result:
|
latitude | Optional. The latitude of the specified location. The default is North latitude. To specify a South Latitude, pass a negative value. |
longitude | Optional. The longitude of the specified location. By default, it refers to Eastern Longitude. If you need to specify the Western Bible, please pass a negative value. |
zenith | Optional. The default is date.sunset_zenith. |
gmtoffset | Optional. Specifies the difference between GMT and local time, in hours. |